<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/vectrics.tld"    prefix="vectrics" %>

<%@ page import="org.vectrics.security.*" %>
<%@ page import="org.vectrics.user.*" %>
<%@ page import="org.vectrics.domain.*" %>
<%@ page import="org.vectrics.provider.*" %>


<vectrics:errors/>

<%@ page import="org.vectrics.struts.*" %>
<%
	Request vectricsRequest = HttpRequestConverter.convertRequest(request);

	Person authPerson = PrivilegeUtils.getAuthPerson(vectricsRequest);
	String personId = request.getParameter("personId");
	String domainId = (String)request.getAttribute("domainId");
	Domain domain = CoreServiceLocator.getSystemService().findDomain(new Long(domainId));
	//UserRole assignAdminRole 
%>
<vectrics:userSummary personId="<%=personId%>" compact="true"/>

<html:form action="/admin/user/person/roles/save" method="POST">
	<html:hidden property="personId"/>
<% 
	// Make sure use has privileges to edit roles.
	if (authPerson.hasDomainOrGlobalRole("assign.admin.roles", domain)) {    
%>
	<vectrics:userRolesSelect personId="<%=personId%>" domainId="<%=domainId%>" hidden="true" global="true"/>
<% } %>
	
	<table width="800">
		<tr>
			<td width="50%">
				<table cellpadding="4" cellspacing="1">
					<tr>
						<td valign="TOP" colspan="3"><br><h3><bean:message key="heading.person.roles.and.groups"/></h3></td>
					</tr>
					<tr>
						<td class="formBg2" valign="top" width="150"><font class="formLabelClass"><bean:message key="prompt.user.roles"/></font></td>
						<td class="formBg2" valign="top">
							<vectrics:userRolesSelect 
									personId="<%=personId%>" 
									domainId="<%=domainId%>"									
									global="true"
									hidden="false"/>
						</td>
						<td></td>
					</tr>
					<tr>
						<td valign="TOP" align="left"></td>
						<td valign="TOP" align="left">
							<vectrics:formButton elementId="ok.btn" code="button.ok" phraseCode="button.ok" value="submit" name="submit"/>
							&nbsp;
							<vectrics:formButton elementId="cancel.btn" code="button.cancel" phraseCode="button.cancel" value="cancel" name="cancel"/>						
						</td>
						<td></td>
					</tr>
				</table>
			</td>
			
		</tr>
	</table>
	
</html:form>
